package com.wangfei.lecture.SM;

import org.apache.commons.codec.binary.Base64;

public class Test1 {
    public static void  main(String[] args) {
        String pubkey = "044b214b8a5508c82974165b722199002634ef16c2e66b10c42656cf68629a63174031da6f52ea4af3fe254ddb4e38b433aa6ae95cde849c94d7fb659159af07e9";
        String sortedString = "appId=1888666&cardCount=1&cardList=accountLevel=99&accountMedia=4&areaCode=0000&cardAttr=01&cardNo=6236 **** 6602&cardSt=02&extensions=null&issInsIdCd=null&reserveMobile=null&extensions=null&msg=成功&nonceStr=fc31a1ee226ee4cd&registerMobile=null&resp=00&symmetricKey=79c8bc701bc7c9ae&timestamp=1663223146815&userId=null";
        String prikey = "00e756a79f96f386da644febaed225283c616a7e2257d73cbe2caf41fa54bb3fe9";
        sortedString = "123456789";
        byte[] result = SMUtil.sm2Sign(prikey, sortedString);
        System.out.println(Base64.encodeBase64String(result));
        System.out.println(SMUtil.sm2SignValidate(pubkey, result, sortedString));
    }
}
